const express = require("express");
const router = express.Router();
const multer = require("multer");
// const fileHandler = require("../modules/fileHandler"); // 文件处理模块
const { file_validation } = require("../validators/common");
const { login, register, updateUserInfo, uploadFile } = require("../controllers/common");
const { createMulterConfig } = require("../modules/fileHandler"); // 文件上传配置
const upload = createMulterConfig(); // 创建上传配置

router.post("/login", login); // 登录
router.post("/register", register); // 注册
router.post("/updateUserInfo", updateUserInfo); // 更新用户数据
router.post("/uploadFile", upload.single("file"), uploadFile); // 文件上传

module.exports = router;
